package cc.mxtt.common.app;

import cc.mxtt.common.interceptor.LoginInterceptor;
import cc.mxtt.common.utils.MD5Util;
import cc.mxtt.mvc.model.User;

import com.jfinal.aop.Clear;
import com.jfinal.core.Controller;

public class AppLoginControl extends Controller {
	@Clear(LoginInterceptor.class)
	public void index(){
		renderText("hello");
	}
	
	@Clear(LoginInterceptor.class)
	public void logintest(){
		
		renderText("200");
		
	}
	
	@Clear(LoginInterceptor.class)
	public void applogin(){
		
		
		String username = getPara("username");
		String password = MD5Util.md5(getPara("password"));
		User user = User.dao.findLoginUser(username, password);
		System.out.println(password);
		if (user != null) {
			renderText("200");
		} else {
			renderText("400");
			
		}
		
	}
	
	
	

}
